<!-- joinUs.html -->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>加入我们</title>
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/CFNetPP_Base.css">
		<style type="text/css">
			.loadFailure {
			    left: 0;
			    top: 0;
			    margin: 0 auto;
			    text-align: center;
			    padding: 40px 0px;
			    width: 100%;
			}
			* {
				-webkit-box-sizing: content-box;
			    box-sizing: content-box; 
			}
		</style>
	</head>
	<body>
		<div class="base_style_color" id='BarAppearance' style="height: 22px;width: 100%"></div>
		<div class="base_navigation_bar base_style_color base_navigation_item_bar">
			<a class="base_left_item" href="#" onclick="backClick()"> <img class="base_back_icon" src="../../image/icon_jiantou.png" alt=""> </a>
			<span>加入我们</span>
			<a class="base_right_item" onclick="onShareClick()">
				<img class="base_item_icon" src="../../image/icon_lan.png">
			</a>
		</div>
		<div class="base_content_div">
			<div class="loadFailure" id="noNet" hidden="hidden">
				<img src="../../image/icon_img01.png" width="60%">
				<p class="" >
					数据加载失败
				</p>
				<p>
					请检查您的网络
				</p>
				<button type="button" class="mui-btn mui-btn-outlined" onclick="setupPageUI()">
					重新加载
				</button>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../../script/jquery.min.js"></script>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript">
		var url = '';
		var title = "快来加入我们";
		var description = "北京络捷斯特科技发展股份有限公司最新招聘信息";
		var thumbUrlQQ = "http://ossimg.cfnet.org.cn/img/20170603/112667-1496458368-70714.png";
		var thumbUrlWV = "widget://image/logosmall.png";
		apiready = function() {
			prepareData();
			setupPageUI();
		}
		//准备数据
		function prepareData(){
			url = 'http://cfnet.org.cn/corp/joinUs/index.html';
		}
		function setupPageUI(){
			if (api.connectionType == 'none') {//没网显示无网络
				$('#noNet').show();
			}else{
				$('#noNet').hide();
				setupFrame();
			}
		}
		function setupFrame(){
			var y = $('#BarAppearance').height() + $('.base_navigation_bar').height();
			api.openFrame({
			    name: 'joinUsFrame',
			    url: url,
			    rect: {
			        x: 0,
			        y: y,
			        w: 'auto',
			        h: 'auto'
			    },
			    bounces: false,
			    progress: {
			    	type: 'page',
			    	title: '加载中...', 
			    	text: '',
			    	color: '#18b4ed'
			    },
			    allowEdit: true
			});
		}
		function backClick(){
			api.closeWin();
		}
		//分享
		function onShareClick() {
			var message;
			var dialogBox = api.require('dialogBox');
			dialogBox.actionMenu({
				tapClose : true,
				rect : {
					h : 208
				},
				texts : {
					cancel : '取消'
				},
				items : [{
					text : '分享到微信',
					icon : 'widget://image/icon_weixin.png'
				}, {
					text : '分享到朋友圈',
					icon : 'widget://image/icon_pengyouquan.png'
				}, {
					text : '分享到手机QQ',
					icon : 'widget://image/icon_qq.png'
				}, {
					text : '分享到QQ空间',
					icon : 'widget://image/icon_kongjian.png'
				}],
				styles : {
					bg : '#F0F0F0',
					column : 4,
					itemText : {
						color : '#000',
						size : 12,
						marginT : 8
					},
					itemIcon : {
						size : 60
					},
					cancel : {
						// bg:'widget://image/icno_share_buttom.png',
						color : '#535353',
						h : 38,
						size : 14
					}
				}
			}, function(ret) {
				var eventType = ret.eventType;
				//判断类型
				var index = ret.index;
				if (eventType == 'cancel') {//关闭
					dialogBox.close({
						dialogName : 'actionMenu'
					});
					return;
				}
				if (index == 2 || index == 3) {
					var qq = api.require('qq');
					qq.installed(function(ret, err) {
						if (ret.status) {
							if (index == 2) {//qq
								qq.shareNews({
									url : url,
									type : 'QFriend',
									title : title,
									description : description,
									imgUrl : thumbUrlQQ
								}, function(ret, err) {
									dialogBox.close({
										dialogName : 'actionMenu'
									});
									if (ret.status) {
										message = title + "分享至QQ";
										api.toast({
											msg : '分享成功QQ'
										});
									} else {
										if (err.code == -4) {
											api.toast({
												msg : '用户取消分享'
											});
										} else if (err.code == 10000) {
											api.toast({
												msg : 'QQ空间分享不支持文本类型分享'
											});
										} else if (err.code == 10001) {
											api.toast({
												msg : 'QQ空间分享不支持图片类型分享'
											});
										} else if (err.code == 10009) {
											api.toast({
												msg : '当前设备未安装QQ客户端'
											});
										} else {
											api.toast({
												msg : '分享失败QQ'
											});
										}
									}
								});
							} else if (index == 3) {//qq空间
								qq.shareNews({
									url : url,
									type : 'QZone',
									title : title,
									description : description,
									imgUrl : thumbUrlQQ
								}, function(ret, err) {
									dialogBox.close({
										dialogName : 'dialogBox'
									});
									if (ret.status) {
										message = title + "分享至QQ空间";
										api.toast({
											msg : '分享成功QQ空间'
										});
									} else {
										if (err.code == -4) {
											api.toast({
												msg : '用户取消分享'
											});
										} else if (err.code == 10000) {
											api.toast({
												msg : 'QQ空间分享不支持文本类型分享'
											});
										} else if (err.code == 10001) {
											api.toast({
												msg : 'QQ空间分享不支持图片类型分享'
											});
										} else if (err.code == 10009) {
											api.toast({
												msg : '当前设备未安装QQ客户端'
											});
										} else {
											api.toast({
												msg : '分享失败QQ空间'
											});
										}
									}
								});
							}
							return;
						} else {
							dialogBox.close({
								dialogName : 'actionMenu'
							});
							alert("没有安装QQ");
							// $("#passFailCount").show();
							//  $("#title_text").html('没有安装QQ');
						}
					});
				}
				if (index == 0 || index == 1) {
					var wx = api.require('wx');
					wx.isInstalled(function(ret, err) {
						if (ret.installed) {
							if (index == 0) {//微信
								wx.shareWebpage({
									apiKey : '',
									scene : 'session',
									title : title,
									description : description,
									thumb : thumbUrlWV,
									contentUrl : url
								}, function(ret, err) {
									dialogBox.close({
										dialogName : 'actionMenu'
									});
									if (ret.status) {
										message = title + "分享至微信好友";
										api.toast({
											msg : '分享成功微信好友'
										});
									} else {
										api.toast({
											msg : '分享失败微信好友'
										});
									}
								});
							} else if (index == 1) {//朋友圈
								wx.shareWebpage({
									apiKey : '',
									scene : 'timeline',
									title : title,
									description : description,
									thumb : thumbUrlWV,
									contentUrl : url
								}, function(ret, err) {
									dialogBox.close({
										dialogName : 'actionMenu'
									});
									if (ret.status) {
										message = title + "分享至朋友圈";
										api.toast({
											msg : '分享成功朋友圈'
										});
									} else {
										api.toast({
											msg : '分享失败朋友圈'
										});
									}
								});
							}
						} else {
							dialogBox.close({
								dialogName : 'actionMenu'
							});
							alert("没有安装微信");
						}
					});
				}
			});
		}
	</script>
</html>